import request from '@/utils/request';
import {AxiosPromise} from 'axios';
import {TravelForm, TravelQuery, TravelVO} from '@/api/biz/travel/types';

/**
 * 查询旅游目的地列表
 * @param query
 * @returns {*}
 */

export const listTravel = (query?: TravelQuery): AxiosPromise<TravelVO[]> => {
  return request({
    url: '/biz/travel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询旅游目的地列表
 * @param query
 * @returns {*}
 */

export const queryListTravel = (query?: TravelQuery): AxiosPromise<TravelVO[]> => {
  return request({
    url: '/biz/travel/queryList',
    method: 'get',
    params: query
  });
};

/**
 * 查询旅游目的地详细
 * @param id
 */
export const getTravel = (id: string | number): AxiosPromise<TravelVO> => {
  return request({
    url: '/biz/travel/' + id,
    method: 'get'
  });
};

/**
 * 新增旅游目的地
 * @param data
 */
export const addTravel = (data: TravelForm) => {
  return request({
    url: '/biz/travel',
    method: 'post',
    data: data
  });
};

/**
 * 修改旅游目的地
 * @param data
 */
export const updateTravel = (data: TravelForm) => {
  return request({
    url: '/biz/travel',
    method: 'put',
    data: data
  });
};

/**
 * 删除旅游目的地
 * @param id
 */
export const delTravel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/travel/' + id,
    method: 'delete'
  });
};
